package org.inspursc.s0517.health.evaluation.converter;

import org.inspursc.s0517.health.evaluation.dto.CustomerDTO;
import org.inspursc.s0517.health.evaluation.entity.Customer;
import org.inspursc.s0517.health.evaluation.form.CustomerForm;
import org.inspursc.s0517.health.evaluation.utils.TimeUtil;
import org.springframework.beans.BeanUtils;



/**
 * @author B_Dream
 * @version 2018/5/18 15:45
 */
public class CustomerConverter {

    public static CustomerDTO converter(CustomerForm userForm) {
        CustomerDTO customerDTO = new CustomerDTO();
        BeanUtils.copyProperties(userForm, customerDTO);
        return customerDTO;
    }

    public static Customer converter(CustomerDTO userDTO) {
        Customer cust = new Customer();
        BeanUtils.copyProperties(userDTO, cust);
        // cust.setBirthday(TimeUtil.toLocalDateToDate(userDTO.getBirthday()));
        return cust;
    }



    public static CustomerDTO converter(Customer customer) {
        CustomerDTO custDTO = new CustomerDTO();
        BeanUtils.copyProperties(customer, custDTO);
        // custDTO.setBirthday(TimeUtil.toDateToLocalDate(customer.getBirthday()));
        return custDTO;
    }


}
